package tw101.bm;

/**
 * Created by Alan on 12/29/13.
 */
public abstract class ShapePrinter {

    //final static String formatString = "%WIDTHs";

    public static int getN (String[] args) {
        int n = 0;

        try {
            n = Integer.parseInt(args[0]);
        } catch(NumberFormatException e) {
            System.out.println("Needs one int as argument");
            System.exit(1);
        }

        return n;
    }

    abstract void makeShape(int n);

    static void printLine(int spaces, int asterisks) {
        String oneLine = "";

        for (int i=0; i<spaces; i++) {
            oneLine += " ";
        }
        for (int i=0; i<asterisks; i++) {
            oneLine += "*";
        }

        System.out.println(oneLine);
    }

}
